{literal}
<script type="text/javascript">
	$(function(){
		$('#addProduct').validate()

		$('#defaultValues tr:last input').live('focus',function(){
			var tr = $(this).parent().parent();
			var totalStrlen = 0;

			tr.find('input').each(function(){totalStrlen = totalStrlen + $(this).val().length});

			if(totalStrlen == 0) {
				tr.after(tr.clone());
				}else{
					alert(totalStrlen);
						}
		});

			$('.systems').click(function(){

						if($(this).attr('checked') == true && $(this).val() == 0){
							$('.metric').attr('disabled',true).addClass('disabled');
						}else{
							$('.metric').attr('disabled',false).removeClass('disabled');
						}
							
				});
	});
</script>


{/literal}
<h1>Dodajesz cechę</h1>

<form method="post" enctype="multipart/form-data" id="addProduct">
{mainoptions title="Dane dla poszczególnych wersji językowych"}
	{assign var=class value=colapse}
	{foreach from=$languages item=lang}
	{capture assign=title}Dane języka: {$lang->getName()}{/capture}
	{mainoptions title=$title class=$class}
	<table cellpadding="0" cellspacing="0" width="100%" class="commonTable">
		<tr>
			<th>Tytuł</th>
			<td><textarea name="description[{$lang->getId()}]"></textarea></td>
		</tr>
		<tr>
			<th>Opis</th>
			<td>{capture assign=text}text_{$lang->getId()}{/capture}{insertFckEditor name=$text}</td>
		</tr>
	</table>
	{/mainoptions}
	{assign var=class value=expand}
	{assign var=required value=1}
	{/foreach}
{/mainoptions}



{mainoptions title="Dane ogólne"}
	<table cellpadding="0" cellspacing="0" width="100%" class="commonTable">
		<tr>
			<th>Kategoria</th>
			<td>
				<select name="id_category">
					{foreach from=$categories item=category}
					{if $category->getChildren()|@count gt 0}
					<option value="{$category->GetId()}">{$category->getName()}</option>
						{foreach from=$category->getChildren() item=child}
						<option value="{$child->getId()}"> - {$child->getName()}</option>
						{/foreach}
					{else}
					<option value="{$category->GetId()}">{$category->getName()}</option>
					{/if}
					{/foreach}
				</select>
			</td>
		</tr>
		<tr>
			<th>Grupa</th>
			<td>
				<select name="id_property_group">
					{foreach from=$groups item=category}
					<option value="{$category->GetId()}">{$category->getName()}</option>
					{/foreach}
				</select>
			</td>
		</tr>
		<tr>
			<th>Aktywny:</th>
			<td>
				<input type="radio" checked="checked" value="1" id="active_1" name="active" /><label for="active_1">tak</label>
				<input type="radio" value="0" id="active_0"  name="active"  /><label for="active_0">nie</label>
			</td>
		</tr>
		<tr>
			<th>Systemy miar:</th>
			<td>
				<input type="radio" class="systems"  checked="checked" value="1" id="type_1" name="type" /><label for="type_1">dwa</label>
				<input type="radio" class="systems" value="0" id="type_0"  name="type"  /><label for="type_0">jeden</label>
			</td>
		</tr>
		<tr style="display: none;">
			<th>Pokaż na listach:</th>
			<td>
				<input type="radio" checked="checked" value="1" id="show_in_list_1" name="show_in_list" /><label for="show_in_list_1">tak</label>
				<input type="radio" value="0" id="show_in_list_0"  name="show_in_list"  /><label for="show_in_list_0">nie</label>
			</td>
		</tr>
		<tr style="display: none;">
			<th>Pokaż przy uzytkownikach:</th>
			<td>
				<input type="radio" checked="checked" value="1" id="show_in_user_1" name="show_in_user" /><label for="show_in_user_1">tak</label>
				<input type="radio" value="0" id="show_in_user_0"  name="show_in_user"  /><label for="show_in_user_0">nie</label>
			</td>
		</tr>
		<tr style="display: none;">
			<th>Pokaż w wyszukiwarce:</th>
			<td>
				<input type="radio" checked="checked" value="1" id="show_in_search_1" name="show_in_search" /><label for="show_in_search_1">tak</label>
				<input type="radio" value="0" id="show_in_search_0"  name="show_in_search"  /><label for="show_in_search_0">nie</label>
			</td>
		</tr>
		<tr>
			<th>Pokaż w filtrach:</th>
			<td>
				<input type="radio" checked="checked" value="1" id="show_in_filters_1" name="show_in_filters" /><label for="show_in_filters_1">tak</label>
				<input type="radio" value="0" id="show_in_filters_0"  name="show_in_filters"  /><label for="show_in_filters_0">nie</label>
			</td>
		</tr>
		<tr>
			<th>Waga:</th>
			<td>
				<input type="text" name="weight" value="0" />
			</td>
		</tr>

	</table>

{/mainoptions}

{mainoptions title="Wartości domyślne"}
	<table class="commonTable" id="defaultValues" cellspacing="0" cellpadding="0" border="0">
		<tr>
			<th>
				Prefix
			</th>
			<th>
				Wartość
			</th>
			<th>
				Postfix
			</th>
			<th>
				Prefix - metric
			</th>
			<th>
				Wartość - metric
			</th>
			<th>
				Postfix - metric
			</th>
		</tr>
		<tr>
			<td>
				<input type="text" size="5" name="property_prepend[0][]" />
			</td>
			<td>
				<input type="text" size="5" name="property_value[0][]" />
			</td>
			<td>
				<input type="text" size="5" name="property_append[0][]" />
			</td>
			<td>
				<input class="metric" type="text" size="5" name="property_prepend[1][]" />
			</td>
			<td>
				<input class="metric" type="text" size="5" name="property_value[1][]" />
			</td>
			<td>
				<input class="metric" type="text" size="5" name="property_append[1][]" />
			</td>
		</tr>
	</table>
{/mainoptions}


{mainoptions}
	<input type="submit" value="Zapisz i przejdź do listy" />
	<input type="button" value="Anuluj" onclick="document.location='{url property=index}'" />
{/mainoptions}
</form>
